package cn.org.qary.listner;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class ProjectNameListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        String contextPath = servletContextEvent.getServletContext().getContextPath();
        servletContextEvent.getServletContext().setAttribute("project_name", contextPath);
        System.out.println("projectName:" + contextPath);
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
